const mongoose = require('mongoose')
const Schema = mongoose.Schema

const billSourceSchema = mongoose.Schema({
  creator: {
    type: Schema.Types.ObjectId,
    ref: 'user'
  },
  state: {
    type: Number,
    default: 10
  },
  totalNum: Number,
  receiveNum: {
    type: Number,
    default: 0
  },
  unitPrice: Number,
  desc: String,
  link: String,
  images: {
    type: Array,
    default: []
  },
  bills: [{
    type: Schema.Types.ObjectId,
    ref: 'bill'
  }]
})

module.exports = mongoose.model('billSource', billSourceSchema)
